import request from "@/utils/request";

/**
 * 创建或者更新定额模板文件夹
 * @param { createFolder } data
 */
export const createFolder = data => {
  return request({
    url: "/quote/folder/createFolder",
    method: "post",
    data
  });
};
/**
 * 定额模板文件夹
 * @param { filieList } data
 */
export const filieList = () => {
  return request({
    url: "/quote/folder/tree",
    method: "get"
  });
};
/**
 * 删除定额模板文件夹
 * @param { deleteFolder } data
 */
export const deleteFolder = folderId => {
  return request({
    url: `/quote/folder/deleteFolder/${folderId}`,
    method: "get"
  });
};
/**
 * 复制文件夹
 * @param { copyFolder } data
 */
export const copyFolder = folderId => {
  return request({
    url: `/quote/folder/copyFolder/${folderId}`,
    method: "get"
  });
};
/**
 * 根据文件夹id获取工程类型
 * @param { getProject } data
 */
export const getProject = (folderId, projectName) => {
  return request({
    url: `quote/project/getProject/${folderId}?projectName=${projectName}`,
    method: "get"
  });
};
/**
 * 创建或者更新工程
 * @param { createProject } data
 */
export const createProject = data => {
  return request({
    url: "/quote/project/createProject",
    method: "post",
    data
  });
};
/**
 * 变更工程状态
 * @param { changeStatus } data
 */
export const changeStatus = data => {
  return request({
    url: "/quote/project/changeStatus",
    method: "post",
    data
  });
};
/**
 * 删除工程类型
 * @param { deleteProject } data
 */
export const deleteProject = projectId => {
  return request({
    url: `quote/project/deleteProject/${projectId}`,
    method: "get"
  });
};
/**
 * 复制工程类型
 * @param { copyProject } data
 */
export const copyProject = projectId => {
  return request({
    url: `/quote/project/copyProject/${projectId}`,
    method: "get"
  });
};
/**
 * 复制工程类型
 * @param { quotaTemplateList }
 */
export const quotaTemplateList = projectId => {
  return request({
    url: `/quote/quotaTemplate/status/list/${projectId}`,
    method: "get"
  });
};
/**
 * 复制工程类型
 * @param { quotaTemplateListOld }
 */
export const quotaTemplateListOld = projectId => {
  return request({
    url: `/quote/quotaTemplate/list/${projectId}`,
    method: "get"
  });
};
/**
 * 定额模板保存/更新
 * @param { saveOrUpdate }
 */
export const saveOrUpdate = data => {
  return request({
    url: "/quote/quotaTemplate/saveOrUpdate",
    method: "post",
    data
  });
};
/**
 * 删除模板信息
 * @param { deleteTemplate }
 */
export const deleteTemplate = quotaId => {
  return request({
    url: `/quote/quotaTemplate/delete/${quotaId}`,
    method: "get"
  });
};
/**
 * 工艺验收标准
 * @param { getStandardTreeSelect }
 */
export const getStandardTreeSelect = () => {
  return request({
    url: "/quote/quotaTemplate/getStandardTreeSelect",
    method: "get"
  });
};
/**
 * 2.获取分类列表
 * @param { categoryList }
 */
export const categoryList = data => {
  return request({
    url: "/quote/shop/query/categoryList",
    method: "post",
    data
  });
};
/**
 * 2.1.获取筛选属性列表
 * @param { categoryList }
 */
export const queryStastsList = data => {
  return request({
    url: "/quote/shop/query/queryStastsList",
    method: "post",
    data
  });
};
/**
 * 分页商品查询
 * @param { getSpListPage }
 */
export const getSpListPage = data => {
  return request({
    url: "/quote/shop/query/page",
    method: "post",
    data
  });
};
/**
 * 分页商品查询new
 */
export const getSpListNewpage = data => {
  return request({
    url: "/quote/shop/query/newPage",
    method: "post",
    data
  });
};
/**
 * 人工列表
 * @param { quotaWorkerList }
 */
export const quotaWorkerList = quotaId => {
  return request({
    url: `/quote/quotaWorker/list/${quotaId}`,
    method: "get"
  });
};
/**
 * 保存/更新人工成本
 * @param { saveOrUpdateAdd }
 */
export const saveOrUpdateAdd = data => {
  return request({
    url: "/quote/quotaWorker/saveOrUpdate",
    method: "post",
    data
  });
};
/**
 * 4.查询商品详情
 * @param { queryProductDetial }
 */
export const queryProductDetial = data => {
  return request({
    url: "/quote/shop/query/product",
    method: "post",
    data
  });
};
/**
 * 4.保存临时商品
 * @param { queryProductDetial }
 */
export const saveTempProduct = data => {
  return request({
    url: "/quote/quotaTemplate/saveTempProduct",
    method: "post",
    data
  });
};
/**
 * 4.获取临时保存的商品
 * @param { getTempProductList }
 */
export const getTempProductList = code => {
  return request({
    url: `/quote/quotaTemplate/getTempProductList?code=${code}`,
    method: "get"
  });
};
/* 保存临时接口
 * @param { saveTempProductList }
 */
export const saveTempProductList = data => {
  return request({
    url: "/mall/tenant/merchant/inboundOrder/saveTempProduct",
    method: "post",
    data
  });
};
/* 删除临时保存的商品
 * @param { delTempProduct }
 */
export const delTempProduct = data => {
  return request({
    url: "/quote/quotaTemplate/delTempProduct",
    method: "post",
    data
  });
};
/* 定额商品保存更新(成本)
 * @param { saveOrUpdateCb }
 */
export const saveOrUpdateCb = data => {
  return request({
    url: "/quote/quotaProduct/saveOrUpdate",
    method: "post",
    data
  });
};
/* 定额商品获取
 * @param { quotaProductList }
 */
export const quotaProductList = (quotaId, productType) => {
  return request({
    url: `/quote/quotaProduct/quotaProductList/${quotaId}?productType=${productType}`,
    method: "get"
  });
};
/* 定额商品获取
 * @param { saveOrUpdateQuotaProductCondition }
 */
export const saveOrUpdateQuotaProductCondition = data => {
  return request({
    url: "/quote/quotaProductCondition/saveOrUpdateQuotaProductCondition",
    method: "post",
    data
  });
};
/* 定额商品保存更新(报价)
 * @param { saveOrUpdateProductMoney }
 */
export const saveOrUpdateProductMoney = data => {
  return request({
    url: "/quote/quotaProduct/saveOrUpdateProductMoney",
    method: "post",
    data
  });
};
/* 定额模版商品条件获取
 * @param { quotaProductConditionList }
 */
export const quotaProductConditionList = (quotaId, productType) => {
  return request({
    url: `/quote/quotaProductCondition/quotaProductConditionList/${quotaId}?productType=${productType}`,
    method: "get"
  });
};
/* 列表
 * @param { quotaWorkerLists }
 */
export const quotaWorkerLists = quotaId => {
  return request({
    url: `/quote/quotaWorker/list/${quotaId}`,
    method: "get"
  });
};
/* 保存/更新人工报价
 * @param { saveOrUpdateMoney }
 */
export const saveOrUpdateMoney = data => {
  return request({
    url: "/quote/quotaWorker/saveOrUpdateMoney",
    method: "post",
    data
  });
};
/* 保存/更新人工报价
 * @param { saveOrUpdateMoney }
 */
/* 定额商品获取
 * @param { quotaProductList }
 */
export const quotaProductLists = (quotaId, productType, code) => {
  return request({
    url: `/quote/quotaProduct/quotaProductList/${quotaId}?productType=${productType}&code=${code}`,
    method: "get"
  });
};

//========================================
/**
 * 保存临时商品
 */
export const saveTempProductOrder = data => {
  return request({
    url: "/mall/tenant/merchant/order/saveTempProduct",
    method: "post",
    data
  });
};
/**
 * 查询临时商品
 */
export const getTempProductListOrder = data => {
  return request({
    url: "/mall/tenant/merchant/order/getTempProductList",
    method: "get",
    params: data
  });
};

/**
 * 删除临时商品
 */
export const delTempProductOrder = data => {
  return request({
    url: "/mall/tenant/merchant/order/delTempProduct",
    method: "post",
    data
  });
};
/**
 * 保存合同订单商品
 */
export const batchSaveProduct = data => {
  return request({
    url: "/mall/tenant/merchant/order/batchSaveProduct",
    method: "post",
    data
  });
};

// 批量修改工程类型排序
export const projectUpdateSort = data => {
  return request({
    url: "/quote/project/updateSort",
    method: "post",
    data
  });
};

// 批量修改定额模板排序
export const quotaTemplateUpdateSort = data => {
  return request({
    url: "/quote/quotaTemplate/updateSort",
    method: "post",
    data
  });
};

// 获取商家下面所有的供应商品牌信息
export const getBrandInfoList = data => {
  return request({
    url: "/mall/tenant/merchant/product/getBrands",
    method: "post"
  });
};
